//选择规格的显示和隐藏
var size=document.getElementById('size');
var close=document.getElementById('close');
var sizeMask=document.getElementById('size-mask');
size.onclick=function () {
    sizeMask.style.display='block';
};
close.onclick=function () {
    sizeMask.style.display='none';
};
//选择大小
$('.choose-cur').click(function () {
    $(this).css({'background':'#cebd78','color':'#fff'}).siblings().css({'background':'#f5f5f5','color':'#333'});
});
//选择加价购
$('.choose-box').on('click', '.jjbox', function () {
    $('.quan').removeClass('cur');
    $(this).children('.quan').addClass('cur');
    var id=$(this).attr('data-jjid');
    $('.jiajg').attr('data-jjid',id)
});
//数量加减
var jia=document.getElementsByClassName('jia')[0];
var jian=document.getElementsByClassName('jian')[0];
var amount=document.getElementsByClassName('amount')[0];
var i=1;
jia.onclick=function () {
    i++;
    amount.value=i;
};
jian.onclick=function () {
    i--;
    if(i<=1){
        i=1;
    }
    amount.value=i;
};
//详情、销量
var info=document.getElementById('info');
var btn=document.getElementsByClassName('btn');
var show=info.getElementsByTagName('div');
for(var l = 0; l < btn.length; l++) {
    btn[l].onclick = function() {
        for(var j = 0; j < btn.length; j++) {
            if(btn[j] == this) {
                show[j].style.display = 'block';
            } else {
                show[j].style.display = 'none';

            }
        }
    }
}
$('.btn').click(function () {
    $(this).css({'border-bottom':'0.04rem solid #cebd78','color':'#cebd78'}).siblings().css({'border-bottom':'0.04rem solid #fff','color':'#333'});
});
